package cn.edu.buaa.sei.jdat.vt;

import java.awt.GraphicsConfiguration;
import java.awt.GraphicsEnvironment;
import java.awt.Toolkit;
import java.io.IOException;

import javax.swing.JFrame;

import cn.edu.buaa.sei.jdat.vt.res.Resources;

import com.cocotingo.snail.ViewContext;

public class Launcher {

	public static void main(String[] args) {
		try {
			
			// load resource, show a splash window if needed
			GraphicsConfiguration gc = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();
			Resources.loadResource(gc);

			// load main window
			JFrame mainFrame = new JFrame(gc);
			mainFrame.setTitle("JDAT Visual Tool");
			mainFrame.setSize(Toolkit.getDefaultToolkit().getScreenSize());
			mainFrame.setExtendedState(JFrame.MAXIMIZED_BOTH);
			mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
			
			// load Snail GUI main view
			final ViewContext context = new ViewContext(mainFrame);
			context.setRootView(new MainView());
			
			// show up all the things
			context.prepareContent();
			mainFrame.setVisible(true);
		
		} catch (IOException e) {
			e.printStackTrace(); // XXX: show error window
		}
	}

}
